package top.dashuizhuyu.study.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.dashuizhuyu.study.dao.UserDao;
import top.dashuizhuyu.study.entity.User;

/**
 * <p>
 *
 * @author dashuizhuyu@foxmail.com
 * @date 2020/1/22 11:28
 **/
@Service
public class UserService {

    private final UserDao userDao;

    @Autowired
    public UserService(UserDao userDao) {
        this.userDao = userDao;
    }

    public User findUserByName(String username) {
        return userDao.findByUserName(username);
    }

    public void saveUser(User user) {
        userDao.saveAndFlush(user);
    }


}
